configurations.create("ktl")

dependencies {
    ktl "com.pinterest:ktlint:0.49.0"
}

tasks.register('ktlint', JavaExec) {
    description = "Check Kotlin code style."
    classpath = configurations.ktl
    main = "com.pinterest.ktlint.Main"
    args "src/**/*.kt"
}

check.dependsOn ktlint

tasks.register('ktlintFormat', JavaExec) {
    description = "Fix Kotlin code style deviations."
    classpath = configurations.ktl
    main = "com.pinterest.ktlint.Main"
    args "-F", "src/**/*.kt"
}
